function Greeks = BS_call_vega(K,sigma,T,t,r,S,n)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Call option greeks via Black-Scholes formula%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Inputs:
%K--Strike Price
%r--interest rate
%sigma--volatility
%T--maturity
%t--current time
%S--Stock Price
%Outputs: delta ,gamma,vega
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Try
%BS_call_vega(10,0.2,1,1/12,0.02,8);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PV_K = K*exp(-r*(T-t));
d1 = (log(S/K) + (r + sigma^2/2)*(T-t))./(sigma*sqrt(T-t));
d2 = d1 - sigma*sqrt(T-t);
Nd1 = normcdf(d1)*1/sqrt(2*pi);
Nd2 = normcdf(d2)*1/sqrt(2*pi);
dNd1 = normpdf(d1)*1/sqrt(2*pi);
delta = Nd1;
gamma = dNd1./(S*sigma*sqrt(T-t));
vega = S*sqrt(T-t)*dNd1;
theta = S*exp(-r*(T-t))*r*Nd1-K*exp(-r*(T-t))*Nd2-S*exp(-r*(T-t))*sigma*dNd1/(2*sqrt(T-t));
switch n
    case 'delta'
        Greeks = delta;
    case 'gamma'
        Greeks = gamma;
    case 'vega'
        Greeks = vega;
    otherwise
        Greeks = theta;
end
end